package com.ybkj.o2o.zhuanche.common.query;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

/**
 * 订单查询条件封装对象.
 * @author hqb
 */
public class OrderQuery {
  private Long orderId;
  
  private Date startTime;
  
  private Date endTime;
  
  private Long companyId;
  
  private String companyName;
  
  private Long rentalCompanyId;
  
  private String rentalCompanyName;
  
  private String orderNo;
  
  private Long passengerId;
  
  private String passengerNameOrPhone;
  
  private String passengerPhone;
  
  private Long employId;
  
  private String employNameOrPhone;
  
  private String employPhone;
  
  private String carNumber;
  
  private Double realPay;
  
  private Long groupId;
  
  private String orderby;
  
  private String[] channelNameArray;
  
  private Integer[] statusArray;
  
  private String statusStr;
 
  private Boolean treatment;
  
  private Boolean review;
  
  private Date startFinishTime;
  
  private Date endFinishTime;
  
  private Date startTreatmentTime;
  
  private Date endTreatmentTime;
  
  private String createOrderName;
  
  private Boolean isClosed;
  
  private Integer page;
  
  private Integer offset;
  
  private Integer rows;
  
  private String appKey;

  private Integer bookStatus;//是否是预约订单 0 否  1 是
  
  private Integer carTypeId;//车型Id
  
  private List<Integer> carTypeIds;//可接单的所有车型
  
  private Double driverLongitude;
  
  private Double driverLatitude;
  
  private Date yuyueTime;

  public Integer getBookStatus() {
    return bookStatus;
  }

  public void setBookStatus(Integer bookStatus) {
    this.bookStatus = bookStatus;
  }

  public Boolean getIsClosed() {
    return isClosed;
  }

  public void setIsClosed(Boolean isClosed) {
    this.isClosed = isClosed;
  }

  public Long getOrderId() {
    return orderId;
  }

  public void setOrderId(Long orderId) {
    this.orderId = orderId;
  }

  public Date getStartTime() {
    return startTime;
  }
  /**
   * 模糊查询.
   */
  
  public void setStartTime(Long startTime) {
    if (startTime != null) {
      this.startTime = new Date(startTime);
    } else {
      this.startTime = null;
    }
  }

  public Date getEndTime() {
    return endTime;
  }
  /**
   * 模糊查询.
   */
  
  public void setEndTime(Long endTime) {
    if (endTime != null) {
      this.endTime = new Date(endTime);
    } else {
      this.endTime = null;
    }
  }

  public Long getCompanyId() {
    return companyId;
  }

  public void setCompanyId(Long companyId) {
    this.companyId = companyId;
  }

  public String getCompanyName() {
    return companyName;
  }
  /**
   * 模糊查询.
   */
  
  public void setCompanyName(String companyName) {
    if (StringUtils.isNotBlank(companyName)) {
      this.companyName = "%" + companyName + "%";
    } else {
      this.companyName = null;
    }
  }
  
  public Long getRentalCompanyId() {
    return rentalCompanyId;
  }

  public void setRentalCompanyId(Long rentalCompanyId) {
    this.rentalCompanyId = rentalCompanyId;
  }

  public String getRentalCompanyName() {
    return rentalCompanyName;
  }

  /**
   * 模糊查询.
   */
  public void setRentalCompanyName(String rentalCompanyName) {
    if (StringUtils.isNotBlank(rentalCompanyName)) {
      this.rentalCompanyName = "%" + rentalCompanyName + "%";
    } else {
      this.rentalCompanyName = null;
    }
  }

  public String getOrderNo() {
    return orderNo;
  }
  /**
   * 模糊查询.
   */
  
  public void setOrderNo(String orderNo) {
    if (StringUtils.isNotBlank(orderNo)) {
      this.orderNo = "%" + orderNo + "%";
    } else {
      this.orderNo = null;
    }
  }

  public Long getPassengerId() {
    return passengerId;
  }

  public void setPassengerId(Long passengerId) {
    this.passengerId = passengerId;
  }

  public String getPassengerNameOrPhone() {
    return passengerNameOrPhone;
  }
  /**
   * 模糊查询.
   */
  
  public void setPassengerNameOrPhone(String passengerNameOrPhone) {
    if (StringUtils.isNotBlank(passengerNameOrPhone)) {
      this.passengerNameOrPhone = "%" + passengerNameOrPhone + "%";
    } else {
      this.passengerNameOrPhone = null;
    }
  }

  public String getPassengerPhone() {
    return passengerPhone;
  }
  /**
   * 模糊查询.
   */
  
  public void setPassengerPhone(String passengerPhone) {
    if (StringUtils.isNotBlank(passengerPhone)) {
      this.passengerPhone = "%" + passengerPhone + "%";
    } else {
      this.passengerPhone = null;
    }
  }

  public Long getEmployId() {
    return employId;
  }

  public void setEmployId(Long employId) {
    this.employId = employId;
  }

  public String getEmployNameOrPhone() {
    return employNameOrPhone;
  }
  /**
   * 模糊查询.
   */
  
  public void setEmployNameOrPhone(String employNameOrPhone) {
    if (StringUtils.isNotBlank(employNameOrPhone)) {
      this.employNameOrPhone = "%" + employNameOrPhone + "%";
    } else {
      this.employNameOrPhone = null;
    }
  }

  public String getEmployPhone() {
    return employPhone;
  }
  /**
   * 模糊查询.
   */
  
  public void setEmployPhone(String employPhone) {
    if (StringUtils.isNotBlank(employPhone)) {
      this.employPhone = "%" + employPhone + "%";
    } else {
      this.employPhone = null;
    }
  }

  public String getCarNumber() {
    return carNumber;
  }
  /**
   * 模糊查询.
   */
  
  public void setCarNumber(String carNumber) {
    if (StringUtils.isNotBlank(carNumber)) {
      this.carNumber = "%" + carNumber + "%";
    } else {
      this.carNumber = null;
    }
  }

  public Double getRealPay() {
    return realPay;
  }

  public void setRealPay(Double realPay) {
    this.realPay = realPay;
  }
  
  public Long getGroupId() {
    return groupId;
  }

  public void setGroupId(Long groupId) {
    this.groupId = groupId;
  }

  public String getOrderby() {
    return orderby;
  }

  public void setOrderby(String orderby) {
    this.orderby = orderby;
  }

  public String[] getChannelNameArray() {
    return channelNameArray;
  }
  /**
   * 模糊查询.
   */
  
  public void setChannelNameArray(String allorderType) {
    if (StringUtils.isNotBlank(allorderType)) {
      String[] split = allorderType.split(",");
      this.channelNameArray = split;
    } else {
      this.channelNameArray = null;
    }
  }

  public Integer[] getStatusArray() {
    return statusArray;
  }
  
  public String getStatusStr() {
    return statusStr;
  }

  public void setStatusStr(String statusStr) {
    this.statusStr = statusStr;
  }

  /**
   * 模糊查询.
   */
  
  public void setStatusArray(String statusStr) {
    if (StringUtils.isNotBlank(statusStr)) {
      if ("new".equals(statusStr)) {
        this.statusArray = new Integer[]{0};
      } else if ("pai".equals(statusStr)) {
        this.statusArray = new Integer[]{1};
      } else if ("jie".equals(statusStr)) {
        this.statusArray = new Integer[]{2};
      } else if ("run".equals(statusStr)) {
        this.statusArray = new Integer[]{3,4};
      } else if ("finish".equals(statusStr)) {
        this.statusArray = new Integer[]{5};
      } else if ("cancel".equals(statusStr)) {
        this.statusArray = new Integer[]{6};
      } else if ("uncancel".equals(statusStr)) {
        this.statusArray = new Integer[]{0,1,2,3,4,5};
      } else if ("waitorrun".equals(statusStr)) {
        this.statusArray = new Integer[]{2,3,4};
      } else {
        String[] str = statusStr.split(",");
        Integer[] array = new Integer[str.length];  
        for (int i = 0 ; i < str.length; i++) {
          array[i] = Integer.valueOf(str[i]);
        }
        this.statusArray = array;
      }
    }
  }

  public Boolean getTreatment() {
    return treatment;
  }

  public void setTreatment(Boolean treatment) {
    this.treatment = treatment;
  }

  public Boolean getReview() {
    return review;
  }

  public void setReview(Boolean review) {
    this.review = review;
  }

  public Date getStartFinishTime() {
    return startFinishTime;
  }
  /**
   * 模糊查询.
   */
  
  public void setStartFinishTime(Long startFinishTime) {
    if (startFinishTime != null) {
      this.startFinishTime = new Date(startFinishTime);
    } else {
      this.startFinishTime = null;
    }
  }

  public Date getEndFinishTime() {
    return endFinishTime;
  }
  /**
   * 模糊查询.
   */
  
  public void setEndFinishTime(Long endFinishTime) {
    if (endFinishTime != null) {
      this.endFinishTime = new Date(endFinishTime);
    } else {
      this.endFinishTime = null;
    }
  }

  public Date getStartTreatmentTime() {
    return startTreatmentTime;
  }

  public void setStartTreatmentTime(Date startTreatmentTime) {
    this.startTreatmentTime = startTreatmentTime;
  }

  public Date getEndTreatmentTime() {
    return endTreatmentTime;
  }

  public void setEndTreatmentTime(Date endTreatmentTime) {
    this.endTreatmentTime = endTreatmentTime;
  }

  public String getCreateOrderName() {
    return createOrderName;
  }
  /**
   * 模糊查询.
   */
  
  public void setCreateOrderName(String createOrderName) {
    if (StringUtils.isNotBlank(createOrderName)) {
      this.createOrderName = "%" + createOrderName + "%";
    } else {
      this.createOrderName = null;
    }
  }

  public Integer getPage() {
    return page;
  }

  public void setPage(Integer page) {
    this.page = page;
  }
  /**
   * 分页参数.
   */
  
  public Integer getOffset() {
    if (getPage() == null || getRows() == null) {
      return null;
    }
    if (getPage() >= 1) {
      return (getPage() - 1) * getRows();
    }
    return offset;
  }

  public void setOffset(Integer offset) {
    this.offset = offset;
  }

  public Integer getRows() {
    return rows;
  }

  public void setRows(Integer rows) {
    this.rows = rows;
  }

  public String getAppKey() {
    return appKey;
  }

  public void setAppKey(String appKey) {
    this.appKey = appKey;
  }

  @Override
  public String toString() {
    return "OrderQuery [orderId=" + orderId + ", startTime=" + startTime + ", endTime=" + endTime
        + ", companyId=" + companyId + ", companyName=" + companyName + ", rentalCompanyName="
        + rentalCompanyName + ", orderNo=" + orderNo + ", passengerId=" + passengerId
        + ", passengerNameOrPhone=" + passengerNameOrPhone + ", passengerPhone=" + passengerPhone
        + ", employId=" + employId + ", employNameOrPhone=" + employNameOrPhone + ", employPhone="
        + employPhone + ", carNumber=" + carNumber + ", realPay=" + realPay + ", groupId="
        + groupId + ", orderby=" + orderby + ", channelNameArray="
        + Arrays.toString(channelNameArray) + ", statusArray=" + Arrays.toString(statusArray)
        + ", treatment=" + treatment + ", startFinishTime=" + startFinishTime + ", endFinishTime="
        + endFinishTime + ", createOrderName=" + createOrderName + ", isClosed=" + isClosed
        + ", page=" + page + ", offset=" + offset + ", rows=" + rows + ", appKey=" + appKey + "]";
  }

public Integer getCarTypeId() {
	return carTypeId;
}

public void setCarTypeId(Integer carTypeId) {
	this.carTypeId = carTypeId;
}

public Double getDriverLongitude() {
	return driverLongitude;
}

public void setDriverLongitude(Double driverLongitude) {
	this.driverLongitude = driverLongitude;
}

public Double getDriverLatitude() {
	return driverLatitude;
}

public void setDriverLatitude(Double driverLatitude) {
	this.driverLatitude = driverLatitude;
}

public Date getYuyueTime() {
	return yuyueTime;
}

public void setYuyueTime(Date yuyueTime) {
	this.yuyueTime = yuyueTime;
}

public List<Integer> getCarTypeIds() {
	return carTypeIds;
}

public void setCarTypeIds(List<Integer> carTypeIds) {
	this.carTypeIds = carTypeIds;
} 
}
